//  -------------------- iSharePoint -------------------- //
// 
//  Company:	IT Complex, LLC
//  Project:	Smart.Common
//  File name:	INotificationContext.cs
//  Developer:	Solomatov Igor
//  Created:	15.04.2012
// 
//  -------------------- iSharePoint -------------------- //

using System;
using System.Collections.Generic;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Workflow;
using Smart.Common.Entities;

namespace Smart.Common.Notifications
{
	/// <summary>
	/// Notification templates
	/// </summary>
	public interface INotificationScope : IWebEntityScope
	{
		/// <summary>
		/// Notification templates
		/// </summary>
		IEntityFacade<NotificationTemplate> Templates { get; }

		/// <summary>
		/// Notification queue
		/// </summary>
		IEntityFacade<NotificationItem> Queue { get; }

		/// <summary>
		/// Load template by <paramref name="templateId"/> (item title)
		/// </summary>
		NotificationTemplate GetTemplate(string templateId);

		/// <summary>
		/// Queue notification message formatting template identified by <paramref name="templateId"/>
		/// </summary>
		/// <returns>true, if succeeded</returns>
		bool QueueItem(string templateId, string emails, IDictionary<string, object> values);

		/// <summary>
		/// Queue notification message formatting template
		/// </summary>
		/// <returns>true, if succeeded</returns>
		bool QueueItem(string subjectTemplate, string bodyTemplate, string emails, IDictionary<string, object> values);

		/// <summary>
		/// Queue notification without formatting
		/// </summary>
		/// <returns>true, if succeeded</returns>
		bool QueueItem(string subject, string body, string emails, DateTime sendAt);

		/// <summary>
		/// Return values collection for <paramref name="item"/>
		/// </summary>
		Dictionary<string, object> GetValues(SPListItem item);

		/// <summary>
		/// Return values collection for <paramref name="item"/>, <paramref name="taskItem"/> and <paramref name="taskProperties"/>
		/// </summary>
		Dictionary<string, object> GetValues(SPListItem item, SPListItem taskItem, SPWorkflowTaskProperties taskProperties);

		/// <summary>
		/// Returns comma or semicolon separated emails for <paramref name="principal"/>
		/// </summary>
		string GetEmails(string principal);

		/// <summary>
		/// Returns comma or semicolon separated emails for <paramref name="principalId"/>
		/// </summary>
		string GetEmails(int principalId);

		/// <summary>
		/// Returns comma or semicolon separated emails for <paramref name="principal"/>
		/// </summary>
		string GetEmails(SPPrincipal principal);

		/// <summary>
		/// Validate email
		/// </summary>
		/// <returns>true, if valid</returns>
		bool IsValidEmail(string email);

		/// <summary>
		/// Validate comma or semicolon separated emails
		/// </summary>
		/// <returns>Valid comma or semicolon separated emails</returns>
		string ValidateEmails(string emails);
	}
}